<!-- 问答题 -->

<template>
  <div>
    <FormNum v-if="obj.rule === 'num'" v-bind="props" half />
    <FormInput v-else-if="obj.rule === 'word'" v-bind="props" />
    <FormName v-else-if="obj.rule === 'name'" v-bind="props" half />
    <FormPhone v-else-if="obj.rule === 'phone'" v-bind="props" half />
    <FormIdNo v-else-if="obj.rule === 'idNo'" v-bind="props" half />
    <FormCarNo v-else-if="obj.rule === 'carNo'" v-bind="props" half />
    <FormLink v-else-if="obj.rule === 'link'" v-bind="props" />
    <FormTextarea v-else v-bind="props" :rows="[3, 10]" />
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import MyRadio from '../MyRadio'

// ============================== 导出组件 ============================== //

export default CORE.extend(MyRadio, {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyTextarea',

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    ...MyRadio.computed,

    /**
     * 属性对象
     */
    props() {
      const { no, tip, min, max, required } = this.obj
      return {
        bind: `no_${no}`,
        tip,
        tipPre: '请填写',
        min,
        max,
        noLabel: true,
        disabled: this.disabled,
        required: required === 1,
      }
    },
  },
})
</script>
